/*package com.fare.taluo.web.action;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;

import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.fare.taluo.BaseFdcAction;
import com.fare.taluo.application.FailtureTaskApplicaion;
import com.fare.taluo.application.StatisticsTaskApplicaion;
import com.fare.taluo.application.StatusTaskApplicaion;
import com.fare.taluo.application.SuccessDetailTaskApplication;
import com.fare.taluo.application.WaitingTaskApplicaion;
import com.fare.taluo.application.WorkingTaskApplicaion;
import com.fare.taluo.application.crawl.TaskQueueLogApplication;
import com.fare.taluo.application.plane.channel.SourceApplication;
import com.fare.taluo.util.DateJsonValueProcessor;
import com.fare.taluo.vo.core.ChannelCountsVo;
import com.fare.taluo.vo.core.FailtureTaskEntityVo;
import com.fare.taluo.vo.core.SourceEntityVO;
import com.fare.taluo.vo.core.StatisticsTaskEntityVo;
import com.fare.taluo.vo.core.StatusTaskEntityVo;
import com.fare.taluo.vo.core.SuccessDetailTaskVo;
import com.fare.taluo.vo.core.TaskRecordEntityVO;
import com.fare.taluo.vo.core.WaitingTaskEntityVo;
import com.fare.taluo.vo.core.WorkingTaskEntityVo;

@Controller("fswInfoAction")
@Scope("prototype")
public class FswInfoAction extends BaseFdcAction{
	*//**
	 * 
	 *//*
	private static final long serialVersionUID = 599641694005825172L;
	@Resource(name="taskQueueLogApplication")
	private TaskQueueLogApplication taskRecordApp;
	@Resource(name="sourceApplication")
	private SourceApplication sourceApp;
	@Resource(name = "failtureTaskApplicaion")
    private FailtureTaskApplicaion failtureTaskApplicaion;
	@Resource(name = "statusTaskApplicaion")
    private StatusTaskApplicaion statusTaskApplicaion;
	@Resource(name = "waitingTaskApplicaion")
    private WaitingTaskApplicaion waitingTaskApplicaion;
	@Resource(name = "workingTaskApplicaion")
    private WorkingTaskApplicaion workingTaskApplicaion;
	@Resource(name = "successDetailTaskApplication")
	private SuccessDetailTaskApplication successDetailTaskApplication;
//	@Resource(name = "statisticsTaskApplicaion")
//	private StatisticsTaskApplicaion statisticsTaskApplicaion;
	
	
	private String ps;//查询指定
	
	private List<FailtureTaskEntityVo> listvoFa = new ArrayList<FailtureTaskEntityVo>();
	private List<StatusTaskEntityVo> listvoFst = new ArrayList<StatusTaskEntityVo>();
	private List<WaitingTaskEntityVo> listvoFwa = new ArrayList<WaitingTaskEntityVo>();
	private List<WorkingTaskEntityVo> listvoFwr= new ArrayList<WorkingTaskEntityVo>();
	private List<SuccessDetailTaskVo> listvoFsu= new ArrayList<SuccessDetailTaskVo>();
	private List<StatisticsTaskEntityVo> listvoReport = new ArrayList<StatisticsTaskEntityVo>();
	
	private String data;//JSON
	private String flag = "1";
	private String Reportgrabchannel="";//渠道
	private String beginTime="";//查询范围-开始时间
	private String endTime="";//查询范围-结束时间
	private String ReportType="";//过滤方式
	private String SymbolType="";//运算符号
	private String tjnum="";//统计数量
	
	private List<TaskRecordEntityVO> taskRecordList;
	
	private String status;
	private Date bstime;
	private Date etime;
	private String grabchannelId;
	
	private List<ChannelCountsVo> ListchannelCountsVo = new ArrayList<ChannelCountsVo>();//hbase抓取数量统计
	
	//渠道 下拉列表
//	private List<SourceEntityVO> channelSourceList = new ArrayList<SourceEntityVO>();
//	
//		//抓取统计报表(首页加载/引擎统计页加载)
//		public String getStatisticsTaskReport(){
//			this.returnPageURL = "/fare/_fswInfo.jsp";
//			SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
//			Date date=new Date();
//			if(flag.equals("1")){
//				endTime=sdf.format(date);
//				date=org.apache.commons.lang3.time.DateUtils.addDays(date,-1);
//				beginTime=sdf.format(date);
//			}else {
//				endTime=sdf.format(date);
//				date=org.apache.commons.lang3.time.DateUtils.addDays(date,-7);
//				beginTime=sdf.format(date);
//			}
////			if(Reportgrabchannel==""){
////				Reportgrabchannel="";
////			}
//			this.listvoReport = this.statisticsTaskApplicaion.getStatisticsTaskEntityVo(Reportgrabchannel,beginTime.trim(),endTime.trim());
//			this.channelSourceList=this.sourceApp.findAllSourceEntity();
//			JsonConfig jsc = new JsonConfig();
//			jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
//			this.data=JSONArray.fromObject(this.listvoReport,jsc).toString();
//			this.ps="re";
//			return "dispatcher";
//		}
		
		//查询指定抓取报表(条件查询（暂时废弃）)
		public String getStatisticeByReport(){
				try {
					this.returnPageURL = "/fare/_fswInfo.jsp";
					if(StringUtils.isBlank(this.tjnum)){
						this.tjnum="0";
					}
					this.listvoReport = this.statisticsTaskApplicaion.getStatisticsTaskByCondition(this.Reportgrabchannel.trim(),this.beginTime.trim(),this.endTime.trim(),this.ReportType,this.SymbolType,Long.parseLong(this.tjnum.trim()));
					this.channelSourceList=this.sourceApp.findAllSourceEntity();
					Map<String, String> maps = new HashMap<String,String>();
					for(int i=0;i<listvoReport.size();i++){
						maps.put(listvoReport.get(i).getGrabdate(), listvoReport.get(i).getGrabdate());
					}
					List<ReportVo> lists = new ArrayList<ReportVo>();
					for(int i=0;i<listvoReport.size();i++){
						if(maps.get(listvoReport.get(i).getGrabdate()).equals(listvoReport.get(i).getGrabdate())){
							List<TestVo> lt = new ArrayList<TestVo>();
							TestVo tv = new TestVo();
							tv.setFailNum(listvoReport.get(i).getFailNum());
							tv.setTotal(listvoReport.get(i).getTotal());
							tv.setSuccessNum(listvoReport.get(i).getSuccessNum());
							tv.setGrabchannel(listvoReport.get(i).getGrabchannel());
							lt.add(tv);
							this.listrv.add(new ReportVo(listvoReport.get(i).getGrabdate(), lt));
						}
					}
					JsonConfig jsc = new JsonConfig();
					jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
					this.data=JSONArray.fromObject(this.listvoReport,jsc).toString();
					this.ps="re";
					return "dispatcher";
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
		}
		
		
		
	//抓取失败
	public String getFwsInfoByPage(){	
		this.returnPageURL = "/fare/_fswInfo.jsp";
		this.listvoFa  = this.failtureTaskApplicaion.getFailtureTaskByPage(1, 10);
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class,new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=net.sf.json.JSONArray.fromObject(this.listvoFa,jsc).toString();
		channelSourceList = sourceApp.findAllSourceEntity();
		this.ps="fa";
		return "dispatcher";
	}
	//抓取状态
	public String getFstInfoByPage(){
		this.returnPageURL = "/fare/_fswInfo.jsp";
		this.listvoFst = this.statusTaskApplicaion.getStatusTaskByPage();
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=JSONArray.fromObject(this.listvoFst,jsc).toString();
		this.ps="fst";
	    return "dispatcher";
	}
	
	//抓取等待
	public String getFwaInfoByPage(){
		this.returnPageURL = "/fare/_fswInfo.jsp";
		this.listvoFwa = this.waitingTaskApplicaion.getWaitingTaskByPage();
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=JSONArray.fromObject(this.listvoFwa,jsc).toString();
		this.ps="fwa";
	    return "dispatcher";
	}
	//抓取工作working
	public String getFwrInfoByPage(){
		this.returnPageURL = "/fare/_fswInfo.jsp";
		this.listvoFwr = this.workingTaskApplicaion.getWorkingTaskByPage();
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=JSONArray.fromObject(this.listvoFwr,jsc).toString();
		this.ps="fwr";
	    return "dispatcher";
	}
	//抓取成功
	public String getFsuInfoByPage(){
		this.returnPageURL = "/fare/_fswInfo.jsp";
		this.listvoFsu = this.successDetailTaskApplication.getSuccessDetailTaskByPage();
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=JSONArray.fromObject(this.listvoFsu,jsc).toString();
		this.ps="fsu";
	    return "dispatcher";
	}
	
	
	
	
	

	public String getTaskRecord(){
		this.returnPageURL = "/fare/_fswInfo.jsp";
		Calendar c = Calendar.getInstance();
		Date endTime = null;
		if (this.bstime != null) {
			c.setTime(this.bstime);
			c.set(Calendar.MONTH, c.get(Calendar.MONTH)+1);
			c.set(Calendar.DAY_OF_MONTH,1);
			c.add(Calendar.DAY_OF_MONTH, -1);
			endTime = c.getTime();
			endTime = new Date(endTime.getTime());
		}
        if(StringUtils.isNotBlank(this.status.trim())){
        	this.status = this.status.trim();
        	if(this.status.equalsIgnoreCase("fail")){
        		this.status = "-2";
        	}
        	if(this.status.equalsIgnoreCase("succse")){
        		this.status = "3";
        	}
        }
		this.taskRecordList = this.taskRecordApp.findAllTaskRecordBygTime(this.bstime,endTime,this.grabchannelId.trim(),this.status);
		JsonConfig jsc = new JsonConfig();
		jsc.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd HH:mm:ss"));
		this.data=JSONArray.fromObject(this.taskRecordList,jsc).toString();
		this.ps="moShow2";
	    return "dispatcher";
	}
	
	
	public StatisticsTaskApplicaion getStatisticsTaskApplicaion() {
		return statisticsTaskApplicaion;
	}

	public void setStatisticsTaskApplicaion(
			StatisticsTaskApplicaion statisticsTaskApplicaion) {
		this.statisticsTaskApplicaion = statisticsTaskApplicaion;
	}

	public SuccessDetailTaskApplication getSuccessDetailTaskApplication() {
		return successDetailTaskApplication;
	}

	public void setSuccessDetailTaskApplication(
			SuccessDetailTaskApplication successDetailTaskApplication) {
		this.successDetailTaskApplication = successDetailTaskApplication;
	}

	public StatusTaskApplicaion getStatusTaskApplicaion() {
		return statusTaskApplicaion;
	}

	public void setStatusTaskApplicaion(StatusTaskApplicaion statusTaskApplicaion) {
		this.statusTaskApplicaion = statusTaskApplicaion;
	}

	public WaitingTaskApplicaion getWaitingTaskApplicaion() {
		return waitingTaskApplicaion;
	}

	public void setWaitingTaskApplicaion(WaitingTaskApplicaion waitingTaskApplicaion) {
		this.waitingTaskApplicaion = waitingTaskApplicaion;
	}

	public WorkingTaskApplicaion getWorkingTaskApplicaion() {
		return workingTaskApplicaion;
	}

	public void setWorkingTaskApplicaion(WorkingTaskApplicaion workingTaskApplicaion) {
		this.workingTaskApplicaion = workingTaskApplicaion;
	}
	
	public String getPs() {
		return ps;
	}

	public void setPs(String ps) {
		this.ps = ps;
	}

	public List<FailtureTaskEntityVo> getListvoFa() {
		return listvoFa;
	}

	public void setListvoFa(List<FailtureTaskEntityVo> listvoFa) {
		this.listvoFa = listvoFa;
	}

	public List<StatusTaskEntityVo> getListvoFst() {
		return listvoFst;
	}

	public void setListvoFst(List<StatusTaskEntityVo> listvoFst) {
		this.listvoFst = listvoFst;
	}

	public List<WaitingTaskEntityVo> getListvoFwa() {
		return listvoFwa;
	}

	public void setListvoFwa(List<WaitingTaskEntityVo> listvoFwa) {
		this.listvoFwa = listvoFwa;
	}

	public List<WorkingTaskEntityVo> getListvoFwr() {
		return listvoFwr;
	}

	public void setListvoFwr(List<WorkingTaskEntityVo> listvoFwr) {
		this.listvoFwr = listvoFwr;
	}

	public List<SuccessDetailTaskVo> getListvoFsu() {
		return listvoFsu;
	}

	public void setListvoFsu(List<SuccessDetailTaskVo> listvoFsu) {
		this.listvoFsu = listvoFsu;
	}
	
	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}
	

	public FailtureTaskApplicaion getFailtureTaskApplicaion() {
		return failtureTaskApplicaion;
	}

	public void setFailtureTaskApplicaion(
			FailtureTaskApplicaion failtureTaskApplicaion) {
		this.failtureTaskApplicaion = failtureTaskApplicaion;
	}
	
	public List<StatisticsTaskEntityVo> getListvoReport() {
		return listvoReport;
	}

	public void setListvoReport(List<StatisticsTaskEntityVo> listvoReport) {
		this.listvoReport = listvoReport;
	}

	public String getReportgrabchannel() {
		return Reportgrabchannel;
	}

	public void setReportgrabchannel(String reportgrabchannel) {
		Reportgrabchannel = reportgrabchannel;
	}

	public String getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(String beginTime) {
		this.beginTime = beginTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getReportType() {
		return ReportType;
	}

	public void setReportType(String reportType) {
		ReportType = reportType;
	}

	public String getSymbolType() {
		return SymbolType;
	}

	public void setSymbolType(String symbolType) {
		SymbolType = symbolType;
	}

	public String getTjnum() {
		return tjnum;
	}

	public void setTjnum(String tjnum) {
		this.tjnum = tjnum;
	}
	public List<TaskRecordEntityVO> getTaskRecordList() {
		return taskRecordList;
	}

	public void setTaskRecordList(List<TaskRecordEntityVO> taskRecordList) {
		this.taskRecordList = taskRecordList;
	}

	public TaskQueueLogApplication getTaskRecordApp() {
		return taskRecordApp;
	}

	public void setTaskRecordApp(TaskQueueLogApplication taskRecordApp) {
		this.taskRecordApp = taskRecordApp;
	}
	
	public String getGrabchannelId() {
		return grabchannelId;
	}

	public void setGrabchannelId(String grabchannelId) {
		this.grabchannelId = grabchannelId;
	}

	public Date getBstime() {
		return bstime;
	}

	public void setBstime(Date bstime) {
		this.bstime = bstime;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	public Date getEtime() {
		return etime;
	}

	public void setEtime(Date etime) {
		this.etime = etime;
	}

	public String getStats() {
		return status;
	}

	public void setStats(String status) {
		this.status = status;
	}
	public List<ChannelCountsVo> getListchannelCountsVo() {
		return ListchannelCountsVo;
	}

	public void setListchannelCountsVo(List<ChannelCountsVo> listchannelCountsVo) {
		ListchannelCountsVo = listchannelCountsVo;
	}
	
	public List<SourceEntityVO> getChannelSourceList() {
		return channelSourceList;
	}

	public void setChannelSourceList(List<SourceEntityVO> channelSourceList) {
		this.channelSourceList = channelSourceList;
	}
	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}
}
*/